Repository navigation
Conversation
Adds a shell script that downloads a ZAP XML report from a remote ZAP instance via its REST API and saves it to the results/ directory. This enables scorecard generation when ZAP and Benchmark run in separate Docker containers without a shared filesystem. Closes #21
- Add mkdir -p results/ before curl writes to it (fixes failure on fresh clone) - Pass API key via X-ZAP-API-Key header instead of URL query param (keeps key out of process list and shell history) - Redirect all error/usage output to stderr - Validate getBenchmarkVersion.sh output is non-empty before building filename
Bumps [com.fasterxml.jackson.core:jackson-databind](https://github.com/FasterXML/jackson-databind) from 2.22.4 to 2.23.0. - [Commits](FasterXML/jackson-databind@jackson-databind-2.22.4...jackson-databind-2.23.0) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-version: 2.23.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
…t/maven/com.fasterxml.jackson.core-jackson-databind-2.23.0 Bump com.fasterxml.jackson.core:jackson-databind from 2.22.4 to 2.23.0
…-zap-results-from-url-21 Add fetchZAPResults.sh script to download ZAP reports from a URL
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
6 open issues
Ifcurlfails before receiving an HTTP response,http_codecan be empty or non-numeric (or… · New Ifcurlfails before receiving an HTTP response,http_codecan be empty or non-numeric (or… · Newsource scripts/requireCommand.shandscripts/getBenchmarkVersion.shassume the script is… · Newsource scripts/requireCommand.shandscripts/getBenchmarkVersion.shassume the script is… · New Passing the API key as a curl command-line header can expose the key via process listings (e.g.,… · New Consider enabling stricter bash error handling near the top (e.g.,set -euo pipefail) so… · New
What changed in this PR
Syncs the fork with upstream OWASP-Benchmark/BenchmarkJava master, including the upstream Jackson databind bump and adding a helper script to download ZAP XML results for scorecard generation.
Changes:
- Added
scripts/fetchZAPResults.shto download and validate a ZAP XML report intoresults/. - Updated
jackson-databinddependency version inpom.xmlto match upstream.
| File | Description |
|---|---|
| scripts/fetchZAPResults.sh | New utility script to fetch ZAP XML reports and save them under results/. |
| pom.xml | Bumps com.fasterxml.jackson.core:jackson-databind version per upstream sync. |
Review effort: Lite
| mkdir -p results/ | ||
| output="results/${filename}" | ||
|
|
||
| curl_args=(-sS -o "${output}" -w '%{http_code}' --connect-timeout 10 --max-time 120) |
| http_code=$(curl "${curl_args[@]}" "${zap_url}") | ||
|
|
||
| if [ "${http_code}" -ne 200 ]; then | ||
| echo "ERROR: Download failed with HTTP status ${http_code}" >&2 | ||
| rm -f "${output}" | ||
| exit 1 | ||
| fi |
| source scripts/requireCommand.sh | ||
|
|
||
| requireCommand curl |
| if [ -n "${2:-}" ]; then | ||
| filename="$2" | ||
| else | ||
| benchmark_version=$(scripts/getBenchmarkVersion.sh) |
| if [ -n "${api_key}" ]; then | ||
| curl_args+=(-H "X-ZAP-API-Key: ${api_key}") | ||
| fi |
| @@ -0,0 +1,77 @@ | |||
| #!/usr/bin/env bash | |||
|
|
|||
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
9 open issues
Ifcurlfails before receiving an HTTP response,http_codecan be empty or non-numeric (or… Ifcurlfails before receiving an HTTP response,http_codecan be empty or non-numeric (or…source scripts/requireCommand.shdepends on the current working directory. If this script is… · New This assumeshttp_codeis always a numeric value. Ifcurlfails in a way that returns a… · New The validation only searches the first 2 lines forOWASPZAPReport. If the XML declaration,… · New Passing the API key as a curl command-line header can expose the key via process listings (e.g.,…source scripts/requireCommand.shandscripts/getBenchmarkVersion.shassume the script is…source scripts/requireCommand.shandscripts/getBenchmarkVersion.shassume the script is… Consider enabling stricter bash error handling near the top (e.g.,set -euo pipefail) so…
Review effort: Lite
| # scripts/fetchZAPResults.sh http://zap:8090/OTHER/core/other/xmlreport/ my-zap-results.xml | ||
| # scripts/fetchZAPResults.sh http://zap:8090/OTHER/core/other/xmlreport/ "" my-secret-api-key | ||
|
|
||
| source scripts/requireCommand.sh |
| curl_args=(-sS -o "${output}" -w '%{http_code}' --connect-timeout 10 --max-time 120) | ||
| if [ -n "${api_key}" ]; then | ||
| curl_args+=(-H "X-ZAP-API-Key: ${api_key}") | ||
| fi | ||
|
|
||
| echo "Downloading ZAP report from: ${zap_url}" | ||
| http_code=$(curl "${curl_args[@]}" "${zap_url}") | ||
|
|
||
| if [ "${http_code}" -ne 200 ]; then | ||
| echo "ERROR: Download failed with HTTP status ${http_code}" >&2 | ||
| rm -f "${output}" | ||
| exit 1 | ||
| fi |
| if ! head -2 "${output}" | grep -q "OWASPZAPReport"; then | ||
| echo "ERROR: Downloaded file does not appear to be a ZAP XML report." >&2 | ||
| echo "First 3 lines of downloaded content:" >&2 | ||
| head -3 "${output}" >&2 | ||
| rm -f "${output}" | ||
| exit 1 | ||
| fi |



Summary
Upstream head:
a452b3aafd232245d0753e54eb243d6651f8ef96.